package com.example.aircraftticketingsystemserver;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

public class Generator {

    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/aircraft-ticketing-system?serverTimezone=UTC", "root", "040825")
                .globalConfig(builder -> builder
                        .author("lxz")
                        .outputDir("src/main/java")
                )
                .packageConfig(builder -> builder
                        .parent("com.example.aircraftticketingsystemserver")
                        .entity("entity")
                        .service("service")
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .entityBuilder()
                        .enableLombok()
                        .naming(NamingStrategy.underline_to_camel) // 表名生成实体类时的命名策略
                        .columnNaming(NamingStrategy.underline_to_camel) // 列名生成属性名时的命名策略
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}